package com.zoo.diannaopeijian.mapper;

import com.zoo.diannaopeijian.domain.ExportItem;
import com.zoo.diannaopeijian.domain.ExportItemExample;
import java.util.List;
import java.util.Map;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.DeleteProvider;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.InsertProvider;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectProvider;
import org.apache.ibatis.annotations.Update;
import org.apache.ibatis.annotations.UpdateProvider;
import org.apache.ibatis.type.JdbcType;

public interface ExportItemMapper {
    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table export_item
     *
     * @mbggenerated
     */
    @SelectProvider(type=ExportItemSqlProvider.class, method="countByExample")
    int countByExample(ExportItemExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table export_item
     *
     * @mbggenerated
     */
    @DeleteProvider(type=ExportItemSqlProvider.class, method="deleteByExample")
    int deleteByExample(ExportItemExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table export_item
     *
     * @mbggenerated
     */
    @Delete({
        "delete from export_item",
        "where ExportItemId = #{exportitemid,jdbcType=INTEGER}"
    })
    int deleteByPrimaryKey(Integer exportitemid);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table export_item
     *
     * @mbggenerated
     */
    @Insert({
        "insert into export_item (ExportItemId, ExportRecordId, ",
        "WareId, ExportChannelId, ",
        "WarehouseId, ExportItemNum, ",
        "ExportItemPrice)",
        "values (#{exportitemid,jdbcType=INTEGER}, #{exportrecordid,jdbcType=INTEGER}, ",
        "#{wareid,jdbcType=INTEGER}, #{exportchannelid,jdbcType=INTEGER}, ",
        "#{warehouseid,jdbcType=INTEGER}, #{exportitemnum,jdbcType=INTEGER}, ",
        "#{exportitemprice,jdbcType=REAL})"
    })
    int insert(ExportItem record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table export_item
     *
     * @mbggenerated
     */
    @InsertProvider(type=ExportItemSqlProvider.class, method="insertSelective")
    int insertSelective(ExportItem record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table export_item
     *
     * @mbggenerated
     */
    @SelectProvider(type=ExportItemSqlProvider.class, method="selectByExample")
    @Results({
        @Result(column="ExportItemId", property="exportitemid", jdbcType=JdbcType.INTEGER, id=true),
        @Result(column="ExportRecordId", property="exportrecordid", jdbcType=JdbcType.INTEGER),
        @Result(column="WareId", property="wareid", jdbcType=JdbcType.INTEGER),
        @Result(column="ExportChannelId", property="exportchannelid", jdbcType=JdbcType.INTEGER),
        @Result(column="WarehouseId", property="warehouseid", jdbcType=JdbcType.INTEGER),
        @Result(column="ExportItemNum", property="exportitemnum", jdbcType=JdbcType.INTEGER),
        @Result(column="ExportItemPrice", property="exportitemprice", jdbcType=JdbcType.REAL)
    })
    List<ExportItem> selectByExample(ExportItemExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table export_item
     *
     * @mbggenerated
     */
    @Select({
        "select",
        "ExportItemId, ExportRecordId, WareId, ExportChannelId, WarehouseId, ExportItemNum, ",
        "ExportItemPrice",
        "from export_item",
        "where ExportItemId = #{exportitemid,jdbcType=INTEGER}"
    })
    @Results({
        @Result(column="ExportItemId", property="exportitemid", jdbcType=JdbcType.INTEGER, id=true),
        @Result(column="ExportRecordId", property="exportrecordid", jdbcType=JdbcType.INTEGER),
        @Result(column="WareId", property="wareid", jdbcType=JdbcType.INTEGER),
        @Result(column="ExportChannelId", property="exportchannelid", jdbcType=JdbcType.INTEGER),
        @Result(column="WarehouseId", property="warehouseid", jdbcType=JdbcType.INTEGER),
        @Result(column="ExportItemNum", property="exportitemnum", jdbcType=JdbcType.INTEGER),
        @Result(column="ExportItemPrice", property="exportitemprice", jdbcType=JdbcType.REAL)
    })
    ExportItem selectByPrimaryKey(Integer exportitemid);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table export_item
     *
     * @mbggenerated
     */
    @UpdateProvider(type=ExportItemSqlProvider.class, method="updateByExampleSelective")
    int updateByExampleSelective(@Param("record") ExportItem record, @Param("example") ExportItemExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table export_item
     *
     * @mbggenerated
     */
    @UpdateProvider(type=ExportItemSqlProvider.class, method="updateByExample")
    int updateByExample(@Param("record") ExportItem record, @Param("example") ExportItemExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table export_item
     *
     * @mbggenerated
     */
    @UpdateProvider(type=ExportItemSqlProvider.class, method="updateByPrimaryKeySelective")
    int updateByPrimaryKeySelective(ExportItem record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table export_item
     *
     * @mbggenerated
     */
    @Update({
        "update export_item",
        "set ExportRecordId = #{exportrecordid,jdbcType=INTEGER},",
          "WareId = #{wareid,jdbcType=INTEGER},",
          "ExportChannelId = #{exportchannelid,jdbcType=INTEGER},",
          "WarehouseId = #{warehouseid,jdbcType=INTEGER},",
          "ExportItemNum = #{exportitemnum,jdbcType=INTEGER},",
          "ExportItemPrice = #{exportitemprice,jdbcType=REAL}",
        "where ExportItemId = #{exportitemid,jdbcType=INTEGER}"
    })
    int updateByPrimaryKey(ExportItem record);

    @Select({
            "select ware.WareName, ware.WareId, house.WarehouseName, house.WarehouseId, exp.ExportChannelName, exp.ExportChannelId, ExportItemId, ExportItemNum, ExportItemPrice ",
            "from export_item as item ",
            "left JOIN warehouse as house ",
            "on house.WarehouseId = item.WarehouseId ",
            "left JOIN ware  ",
            "on ware.WareId = item.WareId ",
            "LEFT JOIN export_channel as exp ",
            "on exp.ExportChannelId = item.ExportChannelId  ",
            "where ExportRecordId = #{exportrecordid,jdbcType=INTEGER}"
    })
    @Results({
            @Result(column = "WareName", property = "warename", jdbcType = JdbcType.VARCHAR),
            @Result(column = "WareId", property = "wareid", jdbcType = JdbcType.INTEGER),
            @Result(column = "WarehouseName", property = "warehousename", jdbcType = JdbcType.VARCHAR),
            @Result(column = "WarehouseId", property = "warehouseid", jdbcType = JdbcType.INTEGER),
            @Result(column = "ExportChannelName", property = "exportchannelname", jdbcType = JdbcType.VARCHAR),
            @Result(column = "ExportChannelId", property = "exportchannelid", jdbcType = JdbcType.INTEGER),
            @Result(column = "ExportItemId", property = "exportitemid", jdbcType = JdbcType.INTEGER),
            @Result(column = "ExportItemNum", property = "exportitemnum", jdbcType = JdbcType.INTEGER),
            @Result(column = "ExportItemPrice", property = "exportitemprice", jdbcType = JdbcType.REAL)
    })
    List<Map> getExportItemsByRecordId(Integer exportrecordid);
}